﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Data.Entity.Infrastructure;

namespace EzyGoEzySystem.Models
{
    /// <summary>
    /// database context to add/remove/update model in EzyGoEzy database
    /// </summary>
    /// <author>Hoang Nguyen Nhat Tao</author>
    public class EzyGoEzyDBContext : DbContext
    {
        public DbSet<Account> Accounts { get; set; }
        public DbSet<TravelJournalEntry> TravelJournalEntries { get; set; }
        public DbSet<PaymentJournalEntry> PaymentJournalEntries { get; set; }
        public DbSet<Bus> Bus { get; set; }
        public DbSet<BusStop> BusStop { get; set; }
        public DbSet<Route> Route { get; set; }
        public DbSet<StraightLineDistance> StraightLineDistance { get; set; }
        public DbSet<AdminConfiguration> AdminConfigurations { get; set; }
        public DbSet<AdminNotification> AdminNotifications { get; set; }
       // public DbSet<AdminNotification> IllegalCustomers { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            modelBuilder.Conventions.Remove<IncludeMetadataConvention>();

            modelBuilder.Configurations.Add(new TravelJournalEntryConfiguration());
            modelBuilder.Configurations.Add(new PaymentJournalEntryConfiguration());
            modelBuilder.Configurations.Add(new RouteConfiguration());
            modelBuilder.Configurations.Add(new StraightLineDistanceConfig());
            //modelBuilder.Configurations.Add(new AdminConfigurations());
            //modelBuilder.Configurations.Add(new StraightLineDistanceConfig());
        }
    }
}